/**
 *@file render.h
 *@author ThomasKing
 *@brief 渲染核心逻辑控制模块
 *@version 0.1
 *@date 2021-03-08
 *
 *@copyright Copyright (c) 2021
 *
 */

#ifndef YUI_GUI_RENDER_H
#define YUI_GUI_RENDER_H

#include "widgets/container.h"

namespace YueGUI {
class Renderer {
public:
    Renderer();
    ~Renderer();

    void AddDirtyRect(const Rect &dirty);

    void Render(const Rect &dirty);

    void SetContainerWidget(Container &container);
    Container &GetContainerWidget();

    void SetScreenWidth(int16_t width);
    int16_t GetScreenWidth() const;

	void SetScreenHeight(int16_t width);
	int16_t GetScreenHeight() const;

private:
    // 渲染开始的根容器,支持动态设置根容器以获取最大限度的绘制自由
    Container *container_ = nullptr;

    Rect dirty_ = {0, 0, 0, 0};
    int16_t width_ = 0;
    int16_t height_ = 0;
};
} // namespace YueGUI
#endif // YUI_GUI_RENDER_H
